//
//  RootViewController.m
//  WANTS购物
//
//  Created by xuNick on 16/5/27.
//  Copyright © 2016年 NN. All rights reserved.
//

#import "RootViewController.h"
#import "HomeViewController.h"
#import "LiveViewController.h"
#import "Buy_cartViewController.h"
#import "MineViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //tabbar外观控制
    [self.tabBar setTintColor:[UIColor blackColor]];
    //添加控制器
    [self addChildVC:[[HomeViewController alloc]init] title:@"首页" image:@"tabbar_market_normal~iphone" seletedImage:@"tabbar_market_selected~iphone"];
     [self addChildVC:[[LiveViewController alloc]init] title:@"笔记" image:@"tabbar_want_normal~iphone" seletedImage:@"tabbar_want_selected~iphone"];
     [self addChildVC:[[Buy_cartViewController alloc]init] title:@"购物车" image:@"tabbar_buy_cart_normal~iphone" seletedImage:@"tabbar_buy_cart_selected~iphone"];
     [self addChildVC:[[MineViewController alloc]init] title:@"我的" image:@"tabbar_mine_normal~iphone" seletedImage:@"tabbar_mine_selected~iphone"];
    
    
    
}

//控制器属性初始化,并添加子控制器
-(void)addChildVC:(UIViewController *)vc title:(NSString *)title image:(NSString *)imgString seletedImage:(NSString *)seletedImg{
    [vc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor]} forState:UIControlStateNormal];
    vc.title = title;
    
    UIImage *img = [UIImage imageNamed:imgString];
    
    vc.tabBarItem.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
   
    UIImage *seletedImage = [UIImage imageNamed:seletedImg];
    vc.tabBarItem.selectedImage = [seletedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [self addChildViewController:vc];
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
